import { get } from "../../utils/db"
Page({
  data: {
    list: [],      //获奖列表
  },
  async onLoad() {
    //获取当天的获奖列表，渲染到页面
    let startTime = new Date(new Date().setHours(0, 0, 0, 0)).getTime();
    //一天是86400秒  
    let endTime = startTime + 86400 * 1000;

    let db = wx.cloud.database()
    let result = await get({
      collection: "logs", where: {
        _createTime: db.command.gte(startTime),
        _createTime: db.command.lte(endTime)
      }
    }).catch(err => {
      console.log(err)
    })
    console.log(result)
    this.setData({
      list: result.data
    })
  }
})